﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BCGC.BLL.Helper;
using BCGC.BLL.BusinessObject.News;
using Jalal.Library.Utility;

public partial class Admin_News_AddNews : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Create_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            if (NewsItem.Create(Security.BindStringInput(tbxTitle.Text, SecurityLevel.Three),
                Security.BindStringInput(fckShortDescription.Value, SecurityLevel.Three),
                Security.BindStringInput(fckDescription.Value, SecurityLevel.Three), cbxActive.Checked,
                cbxFeatured.Checked))
            {
                uccResponse.SetSuccessMessage("News successfuly created");
                ClearInput();
            }
            else
                uccResponse.SetFailMessage("Failed to create news");
        }
    }

    private void ClearInput()
    {
        tbxTitle.Text = string.Empty;
        fckShortDescription.Value = string.Empty;
        fckDescription.Value = string.Empty;
        cbxActive.Checked = false;
        cbxFeatured.Checked = false;
    }
}
